{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# <span style=color:blue>Read tabular data from a PDF report of World Bank for doing some analysis</span>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from tabula import read_pdf\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Open the accompanying PDF file \"WDI-2016\" and browse through it quickly. It is an annual report from World Bank on World Development Indicators (poverty, hunger, child mortality, social mobility, education, etc.)\n",
    "\n",
    "#### Go to pages 68-72 to look at the tables we need toextract in this activity for analysis. They show various statistics for nations around the world."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define a list of page numbers to read"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "pages_to_read = [68,69,70,71,72]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Create a list of column names. This will not be extracted by the PDF reader correctly, so we need to manually use it later.\n",
    "\n",
    "#### Look at the pages 68-72 and come up with these variable names. Use your own judgment."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "column_names = ['Country','Population','Surface area','Population density','Urban pop %',\n",
    "                'GNI Atlas Method (Billions)','GNI Atlas Method (Per capita)','Purchasing power (Billions)',\n",
    "                'Purchasing power (Per capita)','GDP % growth', 'GDP per capita growth']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Test a PDF table extraction by using the `read_pdf` function from Tabula\n",
    "\n",
    "* **You can read details on this library here: https://github.com/chezou/tabula-py**\n",
    "* **You may have to set `multiple_tables=True` in this case**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "lst_tbl1=read_pdf(\"WDI-2016.pdf\",pages=70,multiple_tables=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### If you have done previous step correctly, you should get a simple list back. Check its length and contents. Do you see the table (as a Pandas DataFrame) in the list?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(lst_tbl1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Population</td>\n",
       "      <td>Surface</td>\n",
       "      <td>Population</td>\n",
       "      <td>Urban</td>\n",
       "      <td>Gross national income Gross domestic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>area</td>\n",
       "      <td>density</td>\n",
       "      <td>population</td>\n",
       "      <td>productAtlas method Purchasing power parity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>thousand</td>\n",
       "      <td>people</td>\n",
       "      <td>% of total</td>\n",
       "      <td>Per capita Per capita Per capita</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>millions</td>\n",
       "      <td>sq. km</td>\n",
       "      <td>per sq. km</td>\n",
       "      <td>population</td>\n",
       "      <td>$ billions $ $ billions $ % growth % growth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014 2014 2014 2014 2013–14 2013–14</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            0         1           2           3  \\\n",
       "0  Population   Surface  Population       Urban   \n",
       "1         NaN      area     density  population   \n",
       "2         NaN  thousand      people  % of total   \n",
       "3    millions    sq. km  per sq. km  population   \n",
       "4        2014      2014        2014        2014   \n",
       "\n",
       "                                             4  \n",
       "0         Gross national income Gross domestic  \n",
       "1  productAtlas method Purchasing power parity  \n",
       "2             Per capita Per capita Per capita  \n",
       "3  $ billions $ $ billions $ % growth % growth  \n",
       "4          2014 2014 2014 2014 2013–14 2013–14  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lst_tbl1[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Italy</td>\n",
       "      <td>60.8</td>\n",
       "      <td>301.3</td>\n",
       "      <td>207</td>\n",
       "      <td>69</td>\n",
       "      <td>2,102.2</td>\n",
       "      <td>34,580</td>\n",
       "      <td>2,155.2</td>\n",
       "      <td>35,450</td>\n",
       "      <td>–0.4</td>\n",
       "      <td>–1.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Jamaica</td>\n",
       "      <td>2.7</td>\n",
       "      <td>11.0</td>\n",
       "      <td>251</td>\n",
       "      <td>55</td>\n",
       "      <td>14.0</td>\n",
       "      <td>5,150</td>\n",
       "      <td>23.5</td>\n",
       "      <td>8,640</td>\n",
       "      <td>0.7</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Japan</td>\n",
       "      <td>127.1</td>\n",
       "      <td>378.0</td>\n",
       "      <td>349</td>\n",
       "      <td>93</td>\n",
       "      <td>5,339.1</td>\n",
       "      <td>42,000</td>\n",
       "      <td>4,846.7</td>\n",
       "      <td>38,120</td>\n",
       "      <td>–0.1</td>\n",
       "      <td>0.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jordan</td>\n",
       "      <td>6.6</td>\n",
       "      <td>89.3</td>\n",
       "      <td>74</td>\n",
       "      <td>83</td>\n",
       "      <td>34.1</td>\n",
       "      <td>5,160</td>\n",
       "      <td>78.7</td>\n",
       "      <td>11,910</td>\n",
       "      <td>3.1</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kazakhstan</td>\n",
       "      <td>17.3</td>\n",
       "      <td>2,724.9</td>\n",
       "      <td>6</td>\n",
       "      <td>53</td>\n",
       "      <td>204.8</td>\n",
       "      <td>11,850</td>\n",
       "      <td>375.3</td>\n",
       "      <td>21,710</td>\n",
       "      <td>4.4</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Kenya</td>\n",
       "      <td>44.9</td>\n",
       "      <td>580.4</td>\n",
       "      <td>79</td>\n",
       "      <td>25</td>\n",
       "      <td>58.1</td>\n",
       "      <td>1,290</td>\n",
       "      <td>131.8</td>\n",
       "      <td>2,940</td>\n",
       "      <td>5.3</td>\n",
       "      <td>2.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Kiribati</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.8</td>\n",
       "      <td>136</td>\n",
       "      <td>44</td>\n",
       "      <td>0.3</td>\n",
       "      <td>2,950</td>\n",
       "      <td>0.4a</td>\n",
       "      <td>3,340a</td>\n",
       "      <td>3.7</td>\n",
       "      <td>1.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Korea, Dem. People’s Rep.</td>\n",
       "      <td>25.0</td>\n",
       "      <td>120.5</td>\n",
       "      <td>208</td>\n",
       "      <td>61</td>\n",
       "      <td>..</td>\n",
       "      <td>..j</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Korea, Rep.</td>\n",
       "      <td>50.4</td>\n",
       "      <td>100.3</td>\n",
       "      <td>517</td>\n",
       "      <td>82</td>\n",
       "      <td>1,365.8</td>\n",
       "      <td>27,090</td>\n",
       "      <td>1,697.0</td>\n",
       "      <td>33,650</td>\n",
       "      <td>3.3</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Kosovo</td>\n",
       "      <td>1.8</td>\n",
       "      <td>10.9</td>\n",
       "      <td>167</td>\n",
       "      <td>..</td>\n",
       "      <td>7.3</td>\n",
       "      <td>3,990</td>\n",
       "      <td>17.0a</td>\n",
       "      <td>9,300a</td>\n",
       "      <td>1.2</td>\n",
       "      <td>0.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Kuwait</td>\n",
       "      <td>3.8</td>\n",
       "      <td>17.8</td>\n",
       "      <td>211</td>\n",
       "      <td>98</td>\n",
       "      <td>185.0</td>\n",
       "      <td>49,300</td>\n",
       "      <td>299.7</td>\n",
       "      <td>79,850</td>\n",
       "      <td>–1.6</td>\n",
       "      <td>–5.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Kyrgyz Republic</td>\n",
       "      <td>5.8</td>\n",
       "      <td>199.9</td>\n",
       "      <td>30</td>\n",
       "      <td>36</td>\n",
       "      <td>7.3</td>\n",
       "      <td>1,250</td>\n",
       "      <td>18.8</td>\n",
       "      <td>3,220</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Lao PDR</td>\n",
       "      <td>6.7</td>\n",
       "      <td>236.8</td>\n",
       "      <td>29</td>\n",
       "      <td>38</td>\n",
       "      <td>11.1</td>\n",
       "      <td>1,660</td>\n",
       "      <td>33.8</td>\n",
       "      <td>5,060</td>\n",
       "      <td>7.5</td>\n",
       "      <td>5.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Latvia</td>\n",
       "      <td>2.0</td>\n",
       "      <td>64.5</td>\n",
       "      <td>32</td>\n",
       "      <td>67</td>\n",
       "      <td>30.4</td>\n",
       "      <td>15,250</td>\n",
       "      <td>46.6</td>\n",
       "      <td>23,360</td>\n",
       "      <td>2.4</td>\n",
       "      <td>3.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Lebanon</td>\n",
       "      <td>4.5</td>\n",
       "      <td>10.5</td>\n",
       "      <td>444</td>\n",
       "      <td>88</td>\n",
       "      <td>45.6</td>\n",
       "      <td>10,030</td>\n",
       "      <td>80.0a</td>\n",
       "      <td>17,590a</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Lesotho</td>\n",
       "      <td>2.1</td>\n",
       "      <td>30.4</td>\n",
       "      <td>69</td>\n",
       "      <td>27</td>\n",
       "      <td>2.8</td>\n",
       "      <td>1,330</td>\n",
       "      <td>6.6</td>\n",
       "      <td>3,150</td>\n",
       "      <td>3.6</td>\n",
       "      <td>2.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Liberia</td>\n",
       "      <td>4.4</td>\n",
       "      <td>111.4</td>\n",
       "      <td>46</td>\n",
       "      <td>49</td>\n",
       "      <td>1.6</td>\n",
       "      <td>370</td>\n",
       "      <td>3.1</td>\n",
       "      <td>700</td>\n",
       "      <td>0.7</td>\n",
       "      <td>–1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Libya</td>\n",
       "      <td>6.3</td>\n",
       "      <td>1,759.5</td>\n",
       "      <td>4</td>\n",
       "      <td>78</td>\n",
       "      <td>49.0</td>\n",
       "      <td>7,820</td>\n",
       "      <td>100.1a</td>\n",
       "      <td>16,000a</td>\n",
       "      <td>–24.0</td>\n",
       "      <td>–23.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Liechtenstein</td>\n",
       "      <td>0.0k</td>\n",
       "      <td>0.2</td>\n",
       "      <td>233</td>\n",
       "      <td>14</td>\n",
       "      <td>..</td>\n",
       "      <td>..e</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Lithuania</td>\n",
       "      <td>2.9</td>\n",
       "      <td>65.3</td>\n",
       "      <td>47</td>\n",
       "      <td>67</td>\n",
       "      <td>45.2</td>\n",
       "      <td>15,410</td>\n",
       "      <td>77.4</td>\n",
       "      <td>26,390</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Luxembourg</td>\n",
       "      <td>0.6</td>\n",
       "      <td>2.6</td>\n",
       "      <td>215</td>\n",
       "      <td>90</td>\n",
       "      <td>42.3</td>\n",
       "      <td>75,960</td>\n",
       "      <td>36.5</td>\n",
       "      <td>65,570</td>\n",
       "      <td>4.1</td>\n",
       "      <td>1.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Macedonia, FYR</td>\n",
       "      <td>2.1</td>\n",
       "      <td>25.7</td>\n",
       "      <td>82</td>\n",
       "      <td>57</td>\n",
       "      <td>10.7</td>\n",
       "      <td>5,150</td>\n",
       "      <td>27.3</td>\n",
       "      <td>13,170</td>\n",
       "      <td>3.8</td>\n",
       "      <td>3.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Madagascar</td>\n",
       "      <td>23.6</td>\n",
       "      <td>587.3</td>\n",
       "      <td>41</td>\n",
       "      <td>34</td>\n",
       "      <td>10.4</td>\n",
       "      <td>440</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1,400</td>\n",
       "      <td>3.3</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Malawi</td>\n",
       "      <td>16.7</td>\n",
       "      <td>118.5</td>\n",
       "      <td>177</td>\n",
       "      <td>16</td>\n",
       "      <td>4.2</td>\n",
       "      <td>250</td>\n",
       "      <td>13.2</td>\n",
       "      <td>790</td>\n",
       "      <td>5.7</td>\n",
       "      <td>2.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Malaysia</td>\n",
       "      <td>29.9</td>\n",
       "      <td>330.8</td>\n",
       "      <td>91</td>\n",
       "      <td>74</td>\n",
       "      <td>332.5</td>\n",
       "      <td>11,120</td>\n",
       "      <td>740.8</td>\n",
       "      <td>24,770</td>\n",
       "      <td>6.0</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Maldives</td>\n",
       "      <td>0.4</td>\n",
       "      <td>0.3</td>\n",
       "      <td>1,337</td>\n",
       "      <td>44</td>\n",
       "      <td>2.6</td>\n",
       "      <td>6,410</td>\n",
       "      <td>4.4</td>\n",
       "      <td>10,920</td>\n",
       "      <td>6.5</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Mali</td>\n",
       "      <td>17.1</td>\n",
       "      <td>1,240.2</td>\n",
       "      <td>14</td>\n",
       "      <td>39</td>\n",
       "      <td>11.0</td>\n",
       "      <td>650</td>\n",
       "      <td>25.8</td>\n",
       "      <td>1,510</td>\n",
       "      <td>7.2</td>\n",
       "      <td>4.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Malta</td>\n",
       "      <td>0.4</td>\n",
       "      <td>0.3</td>\n",
       "      <td>1,336</td>\n",
       "      <td>95</td>\n",
       "      <td>8.9</td>\n",
       "      <td>21,000</td>\n",
       "      <td>11.6</td>\n",
       "      <td>27,390</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Marshall Islands</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.2</td>\n",
       "      <td>294</td>\n",
       "      <td>72</td>\n",
       "      <td>0.2</td>\n",
       "      <td>4,390</td>\n",
       "      <td>0.2a</td>\n",
       "      <td>4,700a</td>\n",
       "      <td>–1.0</td>\n",
       "      <td>–1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Mauritania</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1,030.7</td>\n",
       "      <td>4</td>\n",
       "      <td>59</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1,270</td>\n",
       "      <td>14.7</td>\n",
       "      <td>3,710</td>\n",
       "      <td>6.4</td>\n",
       "      <td>3.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Mauritius</td>\n",
       "      <td>1.3</td>\n",
       "      <td>2.0</td>\n",
       "      <td>621</td>\n",
       "      <td>40</td>\n",
       "      <td>12.1</td>\n",
       "      <td>9,630</td>\n",
       "      <td>22.9</td>\n",
       "      <td>18,150</td>\n",
       "      <td>3.6</td>\n",
       "      <td>3.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Mexico</td>\n",
       "      <td>125.4</td>\n",
       "      <td>1,964.4</td>\n",
       "      <td>65</td>\n",
       "      <td>79</td>\n",
       "      <td>1,237.5</td>\n",
       "      <td>9,870</td>\n",
       "      <td>2,111.2</td>\n",
       "      <td>16,840</td>\n",
       "      <td>2.2</td>\n",
       "      <td>0.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Micronesia, Fed. Sts.</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.7</td>\n",
       "      <td>149</td>\n",
       "      <td>22</td>\n",
       "      <td>0.3</td>\n",
       "      <td>3,200</td>\n",
       "      <td>0.4a</td>\n",
       "      <td>3,590a</td>\n",
       "      <td>–3.4</td>\n",
       "      <td>–3.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Moldova</td>\n",
       "      <td>3.6p</td>\n",
       "      <td>33.9</td>\n",
       "      <td>124p</td>\n",
       "      <td>45</td>\n",
       "      <td>9.1p</td>\n",
       "      <td>2,560p</td>\n",
       "      <td>19.6p</td>\n",
       "      <td>5,500p</td>\n",
       "      <td>4.6p</td>\n",
       "      <td>4.7p</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Monaco</td>\n",
       "      <td>0.0k</td>\n",
       "      <td>0.0f</td>\n",
       "      <td>18,812</td>\n",
       "      <td>100</td>\n",
       "      <td>..</td>\n",
       "      <td>..e</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Mongolia</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1,564.1</td>\n",
       "      <td>2</td>\n",
       "      <td>71</td>\n",
       "      <td>12.5</td>\n",
       "      <td>4,280</td>\n",
       "      <td>32.4</td>\n",
       "      <td>11,120</td>\n",
       "      <td>7.8</td>\n",
       "      <td>5.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Montenegro</td>\n",
       "      <td>0.6</td>\n",
       "      <td>13.8</td>\n",
       "      <td>46</td>\n",
       "      <td>64</td>\n",
       "      <td>4.5</td>\n",
       "      <td>7,320</td>\n",
       "      <td>9.5</td>\n",
       "      <td>15,250</td>\n",
       "      <td>1.8</td>\n",
       "      <td>1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>Morocco</td>\n",
       "      <td>33.9</td>\n",
       "      <td>446.6</td>\n",
       "      <td>76</td>\n",
       "      <td>60</td>\n",
       "      <td>105.8q</td>\n",
       "      <td>3,070q</td>\n",
       "      <td>251.5q</td>\n",
       "      <td>7,290q</td>\n",
       "      <td>2.4q</td>\n",
       "      <td>1.0q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Mozambique</td>\n",
       "      <td>27.2</td>\n",
       "      <td>799.4</td>\n",
       "      <td>35</td>\n",
       "      <td>32</td>\n",
       "      <td>16.4</td>\n",
       "      <td>600</td>\n",
       "      <td>30.3</td>\n",
       "      <td>1,120</td>\n",
       "      <td>7.2</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>Myanmar</td>\n",
       "      <td>53.4</td>\n",
       "      <td>676.6</td>\n",
       "      <td>82</td>\n",
       "      <td>34</td>\n",
       "      <td>68.1</td>\n",
       "      <td>1,270</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>8.5</td>\n",
       "      <td>7.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>Namibia</td>\n",
       "      <td>2.4</td>\n",
       "      <td>824.3</td>\n",
       "      <td>3</td>\n",
       "      <td>46</td>\n",
       "      <td>13.5</td>\n",
       "      <td>5,630</td>\n",
       "      <td>23.6</td>\n",
       "      <td>9,810</td>\n",
       "      <td>6.4</td>\n",
       "      <td>3.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>Nepal</td>\n",
       "      <td>28.2</td>\n",
       "      <td>147.2</td>\n",
       "      <td>197</td>\n",
       "      <td>18</td>\n",
       "      <td>20.6</td>\n",
       "      <td>730</td>\n",
       "      <td>68.0</td>\n",
       "      <td>2,410</td>\n",
       "      <td>5.4</td>\n",
       "      <td>4.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>16.9</td>\n",
       "      <td>41.5</td>\n",
       "      <td>501</td>\n",
       "      <td>90</td>\n",
       "      <td>874.6</td>\n",
       "      <td>51,860</td>\n",
       "      <td>824.1</td>\n",
       "      <td>48,860</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>New Caledonia</td>\n",
       "      <td>0.3</td>\n",
       "      <td>18.6</td>\n",
       "      <td>15</td>\n",
       "      <td>70</td>\n",
       "      <td>..</td>\n",
       "      <td>..e</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>New Zealand</td>\n",
       "      <td>4.5</td>\n",
       "      <td>267.7</td>\n",
       "      <td>17</td>\n",
       "      <td>86</td>\n",
       "      <td>185.2</td>\n",
       "      <td>41,070</td>\n",
       "      <td>163.3</td>\n",
       "      <td>36,200</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Nicaragua</td>\n",
       "      <td>6.0</td>\n",
       "      <td>130.4</td>\n",
       "      <td>50</td>\n",
       "      <td>58</td>\n",
       "      <td>11.3</td>\n",
       "      <td>1,870</td>\n",
       "      <td>28.8</td>\n",
       "      <td>4,790</td>\n",
       "      <td>4.7</td>\n",
       "      <td>3.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>Niger</td>\n",
       "      <td>19.1</td>\n",
       "      <td>1,267.0</td>\n",
       "      <td>15</td>\n",
       "      <td>18</td>\n",
       "      <td>7.8</td>\n",
       "      <td>410</td>\n",
       "      <td>17.4</td>\n",
       "      <td>910</td>\n",
       "      <td>6.9</td>\n",
       "      <td>2.7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           0      1        2       3    4        5       6   \\\n",
       "0                       Italy   60.8    301.3     207   69  2,102.2  34,580   \n",
       "1                     Jamaica    2.7     11.0     251   55     14.0   5,150   \n",
       "2                       Japan  127.1    378.0     349   93  5,339.1  42,000   \n",
       "3                      Jordan    6.6     89.3      74   83     34.1   5,160   \n",
       "4                  Kazakhstan   17.3  2,724.9       6   53    204.8  11,850   \n",
       "5                       Kenya   44.9    580.4      79   25     58.1   1,290   \n",
       "6                    Kiribati    0.1      0.8     136   44      0.3   2,950   \n",
       "7   Korea, Dem. People’s Rep.   25.0    120.5     208   61       ..     ..j   \n",
       "8                 Korea, Rep.   50.4    100.3     517   82  1,365.8  27,090   \n",
       "9                      Kosovo    1.8     10.9     167   ..      7.3   3,990   \n",
       "10                     Kuwait    3.8     17.8     211   98    185.0  49,300   \n",
       "11            Kyrgyz Republic    5.8    199.9      30   36      7.3   1,250   \n",
       "12                    Lao PDR    6.7    236.8      29   38     11.1   1,660   \n",
       "13                     Latvia    2.0     64.5      32   67     30.4  15,250   \n",
       "14                    Lebanon    4.5     10.5     444   88     45.6  10,030   \n",
       "15                    Lesotho    2.1     30.4      69   27      2.8   1,330   \n",
       "16                    Liberia    4.4    111.4      46   49      1.6     370   \n",
       "17                      Libya    6.3  1,759.5       4   78     49.0   7,820   \n",
       "18              Liechtenstein   0.0k      0.2     233   14       ..     ..e   \n",
       "19                  Lithuania    2.9     65.3      47   67     45.2  15,410   \n",
       "20                 Luxembourg    0.6      2.6     215   90     42.3  75,960   \n",
       "21             Macedonia, FYR    2.1     25.7      82   57     10.7   5,150   \n",
       "22                 Madagascar   23.6    587.3      41   34     10.4     440   \n",
       "23                     Malawi   16.7    118.5     177   16      4.2     250   \n",
       "24                   Malaysia   29.9    330.8      91   74    332.5  11,120   \n",
       "25                   Maldives    0.4      0.3   1,337   44      2.6   6,410   \n",
       "26                       Mali   17.1  1,240.2      14   39     11.0     650   \n",
       "27                      Malta    0.4      0.3   1,336   95      8.9  21,000   \n",
       "28           Marshall Islands    0.1      0.2     294   72      0.2   4,390   \n",
       "29                 Mauritania    4.0  1,030.7       4   59      5.0   1,270   \n",
       "30                  Mauritius    1.3      2.0     621   40     12.1   9,630   \n",
       "31                     Mexico  125.4  1,964.4      65   79  1,237.5   9,870   \n",
       "32      Micronesia, Fed. Sts.    0.1      0.7     149   22      0.3   3,200   \n",
       "33                    Moldova   3.6p     33.9    124p   45     9.1p  2,560p   \n",
       "34                     Monaco   0.0k     0.0f  18,812  100       ..     ..e   \n",
       "35                   Mongolia    2.9  1,564.1       2   71     12.5   4,280   \n",
       "36                 Montenegro    0.6     13.8      46   64      4.5   7,320   \n",
       "37                    Morocco   33.9    446.6      76   60   105.8q  3,070q   \n",
       "38                 Mozambique   27.2    799.4      35   32     16.4     600   \n",
       "39                    Myanmar   53.4    676.6      82   34     68.1   1,270   \n",
       "40                    Namibia    2.4    824.3       3   46     13.5   5,630   \n",
       "41                      Nepal   28.2    147.2     197   18     20.6     730   \n",
       "42                Netherlands   16.9     41.5     501   90    874.6  51,860   \n",
       "43              New Caledonia    0.3     18.6      15   70       ..     ..e   \n",
       "44                New Zealand    4.5    267.7      17   86    185.2  41,070   \n",
       "45                  Nicaragua    6.0    130.4      50   58     11.3   1,870   \n",
       "46                      Niger   19.1  1,267.0      15   18      7.8     410   \n",
       "\n",
       "         7        8      9      10  \n",
       "0   2,155.2   35,450   –0.4   –1.4  \n",
       "1      23.5    8,640    0.7    0.5  \n",
       "2   4,846.7   38,120   –0.1    0.1  \n",
       "3      78.7   11,910    3.1    0.8  \n",
       "4     375.3   21,710    4.4    2.9  \n",
       "5     131.8    2,940    5.3    2.6  \n",
       "6      0.4a   3,340a    3.7    1.9  \n",
       "7        ..       ..     ..     ..  \n",
       "8   1,697.0   33,650    3.3    2.9  \n",
       "9     17.0a   9,300a    1.2    0.9  \n",
       "10    299.7   79,850   –1.6   –5.8  \n",
       "11     18.8    3,220    3.6    1.5  \n",
       "12     33.8    5,060    7.5    5.8  \n",
       "13     46.6   23,360    2.4    3.3  \n",
       "14    80.0a  17,590a    2.0    0.8  \n",
       "15      6.6    3,150    3.6    2.4  \n",
       "16      3.1      700    0.7   –1.7  \n",
       "17   100.1a  16,000a  –24.0  –23.9  \n",
       "18       ..       ..     ..     ..  \n",
       "19     77.4   26,390    3.0    3.9  \n",
       "20     36.5   65,570    4.1    1.6  \n",
       "21     27.3   13,170    3.8    3.6  \n",
       "22     33.0    1,400    3.3    0.5  \n",
       "23     13.2      790    5.7    2.5  \n",
       "24    740.8   24,770    6.0    4.4  \n",
       "25      4.4   10,920    6.5    4.4  \n",
       "26     25.8    1,510    7.2    4.1  \n",
       "27     11.6   27,390    2.9    1.9  \n",
       "28     0.2a   4,700a   –1.0   –1.2  \n",
       "29     14.7    3,710    6.4    3.8  \n",
       "30     22.9   18,150    3.6    3.4  \n",
       "31  2,111.2   16,840    2.2    0.9  \n",
       "32     0.4a   3,590a   –3.4   –3.7  \n",
       "33    19.6p   5,500p   4.6p   4.7p  \n",
       "34       ..       ..     ..     ..  \n",
       "35     32.4   11,120    7.8    5.9  \n",
       "36      9.5   15,250    1.8    1.7  \n",
       "37   251.5q   7,290q   2.4q   1.0q  \n",
       "38     30.3    1,120    7.2    4.3  \n",
       "39       ..       ..    8.5    7.6  \n",
       "40     23.6    9,810    6.4    3.9  \n",
       "41     68.0    2,410    5.4    4.1  \n",
       "42    824.1   48,860    1.0    0.6  \n",
       "43       ..       ..     ..     ..  \n",
       "44    163.3   36,200    3.0    1.5  \n",
       "45     28.8    4,790    4.7    3.5  \n",
       "46     17.4      910    6.9    2.7  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lst_tbl1[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### It looks like that the 2nd element of the list is the table we want to extract. Let's assign it to a DataFrame and check first few rows using `head` method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = lst_tbl1[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Italy</td>\n",
       "      <td>60.8</td>\n",
       "      <td>301.3</td>\n",
       "      <td>207</td>\n",
       "      <td>69</td>\n",
       "      <td>2,102.2</td>\n",
       "      <td>34,580</td>\n",
       "      <td>2,155.2</td>\n",
       "      <td>35,450</td>\n",
       "      <td>–0.4</td>\n",
       "      <td>–1.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Jamaica</td>\n",
       "      <td>2.7</td>\n",
       "      <td>11.0</td>\n",
       "      <td>251</td>\n",
       "      <td>55</td>\n",
       "      <td>14.0</td>\n",
       "      <td>5,150</td>\n",
       "      <td>23.5</td>\n",
       "      <td>8,640</td>\n",
       "      <td>0.7</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Japan</td>\n",
       "      <td>127.1</td>\n",
       "      <td>378.0</td>\n",
       "      <td>349</td>\n",
       "      <td>93</td>\n",
       "      <td>5,339.1</td>\n",
       "      <td>42,000</td>\n",
       "      <td>4,846.7</td>\n",
       "      <td>38,120</td>\n",
       "      <td>–0.1</td>\n",
       "      <td>0.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jordan</td>\n",
       "      <td>6.6</td>\n",
       "      <td>89.3</td>\n",
       "      <td>74</td>\n",
       "      <td>83</td>\n",
       "      <td>34.1</td>\n",
       "      <td>5,160</td>\n",
       "      <td>78.7</td>\n",
       "      <td>11,910</td>\n",
       "      <td>3.1</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kazakhstan</td>\n",
       "      <td>17.3</td>\n",
       "      <td>2,724.9</td>\n",
       "      <td>6</td>\n",
       "      <td>53</td>\n",
       "      <td>204.8</td>\n",
       "      <td>11,850</td>\n",
       "      <td>375.3</td>\n",
       "      <td>21,710</td>\n",
       "      <td>4.4</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           0      1        2    3   4        5       6        7       8   \\\n",
       "0       Italy   60.8    301.3  207  69  2,102.2  34,580  2,155.2  35,450   \n",
       "1     Jamaica    2.7     11.0  251  55     14.0   5,150     23.5   8,640   \n",
       "2       Japan  127.1    378.0  349  93  5,339.1  42,000  4,846.7  38,120   \n",
       "3      Jordan    6.6     89.3   74  83     34.1   5,160     78.7  11,910   \n",
       "4  Kazakhstan   17.3  2,724.9    6  53    204.8  11,850    375.3  21,710   \n",
       "\n",
       "     9     10  \n",
       "0  –0.4  –1.4  \n",
       "1   0.7   0.5  \n",
       "2  –0.1   0.1  \n",
       "3   3.1   0.8  \n",
       "4   4.4   2.9  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### You should observe that the column headers are just numbers. Here, we need to use the defined list of variables we created earlier. Assign that list as column names of this DataFrame. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.columns = column_names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Population</th>\n",
       "      <th>Surface area</th>\n",
       "      <th>Population density</th>\n",
       "      <th>Urban pop %</th>\n",
       "      <th>GNI Atlas Method (Billions)</th>\n",
       "      <th>GNI Atlas Method (Per capita)</th>\n",
       "      <th>Purchasing power (Billions)</th>\n",
       "      <th>Purchasing power (Per capita)</th>\n",
       "      <th>GDP % growth</th>\n",
       "      <th>GDP per capita growth</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Italy</td>\n",
       "      <td>60.8</td>\n",
       "      <td>301.3</td>\n",
       "      <td>207</td>\n",
       "      <td>69</td>\n",
       "      <td>2,102.2</td>\n",
       "      <td>34,580</td>\n",
       "      <td>2,155.2</td>\n",
       "      <td>35,450</td>\n",
       "      <td>–0.4</td>\n",
       "      <td>–1.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Jamaica</td>\n",
       "      <td>2.7</td>\n",
       "      <td>11.0</td>\n",
       "      <td>251</td>\n",
       "      <td>55</td>\n",
       "      <td>14.0</td>\n",
       "      <td>5,150</td>\n",
       "      <td>23.5</td>\n",
       "      <td>8,640</td>\n",
       "      <td>0.7</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Japan</td>\n",
       "      <td>127.1</td>\n",
       "      <td>378.0</td>\n",
       "      <td>349</td>\n",
       "      <td>93</td>\n",
       "      <td>5,339.1</td>\n",
       "      <td>42,000</td>\n",
       "      <td>4,846.7</td>\n",
       "      <td>38,120</td>\n",
       "      <td>–0.1</td>\n",
       "      <td>0.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jordan</td>\n",
       "      <td>6.6</td>\n",
       "      <td>89.3</td>\n",
       "      <td>74</td>\n",
       "      <td>83</td>\n",
       "      <td>34.1</td>\n",
       "      <td>5,160</td>\n",
       "      <td>78.7</td>\n",
       "      <td>11,910</td>\n",
       "      <td>3.1</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kazakhstan</td>\n",
       "      <td>17.3</td>\n",
       "      <td>2,724.9</td>\n",
       "      <td>6</td>\n",
       "      <td>53</td>\n",
       "      <td>204.8</td>\n",
       "      <td>11,850</td>\n",
       "      <td>375.3</td>\n",
       "      <td>21,710</td>\n",
       "      <td>4.4</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Country Population Surface area Population density Urban pop %  \\\n",
       "0       Italy       60.8        301.3                207          69   \n",
       "1     Jamaica        2.7         11.0                251          55   \n",
       "2       Japan      127.1        378.0                349          93   \n",
       "3      Jordan        6.6         89.3                 74          83   \n",
       "4  Kazakhstan       17.3      2,724.9                  6          53   \n",
       "\n",
       "  GNI Atlas Method (Billions) GNI Atlas Method (Per capita)  \\\n",
       "0                     2,102.2                        34,580   \n",
       "1                        14.0                         5,150   \n",
       "2                     5,339.1                        42,000   \n",
       "3                        34.1                         5,160   \n",
       "4                       204.8                        11,850   \n",
       "\n",
       "  Purchasing power (Billions) Purchasing power (Per capita) GDP % growth  \\\n",
       "0                     2,155.2                        35,450         –0.4   \n",
       "1                        23.5                         8,640          0.7   \n",
       "2                     4,846.7                        38,120         –0.1   \n",
       "3                        78.7                        11,910          3.1   \n",
       "4                       375.3                        21,710          4.4   \n",
       "\n",
       "  GDP per capita growth  \n",
       "0                  –1.4  \n",
       "1                   0.5  \n",
       "2                   0.1  \n",
       "3                   0.8  \n",
       "4                   2.9  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Next, write a loop to create such DataFrames by reading data tables from the pages 68-72 of the PDF file. You can store those DataFrames in a list for concatenating later."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Finished processing page: 68\n",
      "Finished processing page: 69\n",
      "Finished processing page: 70\n",
      "Finished processing page: 71\n",
      "Finished processing page: 72\n"
     ]
    }
   ],
   "source": [
    "# Empty list to store DataFrames\n",
    "list_of_df = []\n",
    "# Loop for reading tables from the PDF file page by page\n",
    "for pg in pages_to_read:\n",
    "    lst_tbl=read_pdf(\"WDI-2016.pdf\",pages=pg,multiple_tables=True)\n",
    "    df = lst_tbl[1]\n",
    "    df.columns=column_names\n",
    "    list_of_df.append(df)\n",
    "    print(\"Finished processing page: {}\".format(pg))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Examine individual DataFrames from the list. Does the last DataFrame look alright?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Population</th>\n",
       "      <th>Surface area</th>\n",
       "      <th>Population density</th>\n",
       "      <th>Urban pop %</th>\n",
       "      <th>GNI Atlas Method (Billions)</th>\n",
       "      <th>GNI Atlas Method (Per capita)</th>\n",
       "      <th>Purchasing power (Billions)</th>\n",
       "      <th>Purchasing power (Per capita)</th>\n",
       "      <th>GDP % growth</th>\n",
       "      <th>GDP per capita growth</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Tanzania</td>\n",
       "      <td>51.8</td>\n",
       "      <td>947.3</td>\n",
       "      <td>59</td>\n",
       "      <td>31</td>\n",
       "      <td>46.4t</td>\n",
       "      <td>920t</td>\n",
       "      <td>126.3t</td>\n",
       "      <td>2,510t</td>\n",
       "      <td>7.0t</td>\n",
       "      <td>3.6t</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thailand</td>\n",
       "      <td>67.7</td>\n",
       "      <td>513.1</td>\n",
       "      <td>133</td>\n",
       "      <td>49</td>\n",
       "      <td>391.7</td>\n",
       "      <td>5,780</td>\n",
       "      <td>1,006.9</td>\n",
       "      <td>14,870</td>\n",
       "      <td>0.9</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Timor-Leste</td>\n",
       "      <td>1.2</td>\n",
       "      <td>14.9</td>\n",
       "      <td>82</td>\n",
       "      <td>32</td>\n",
       "      <td>3.2</td>\n",
       "      <td>2,680</td>\n",
       "      <td>6.2a</td>\n",
       "      <td>5,080a</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Togo</td>\n",
       "      <td>7.1</td>\n",
       "      <td>56.8</td>\n",
       "      <td>131</td>\n",
       "      <td>39</td>\n",
       "      <td>4.0</td>\n",
       "      <td>570</td>\n",
       "      <td>9.2</td>\n",
       "      <td>1,290</td>\n",
       "      <td>5.7</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Tonga</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.8</td>\n",
       "      <td>147</td>\n",
       "      <td>24</td>\n",
       "      <td>0.4</td>\n",
       "      <td>4,260</td>\n",
       "      <td>0.6a</td>\n",
       "      <td>5,270a</td>\n",
       "      <td>2.1</td>\n",
       "      <td>1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Trinidad and Tobago</td>\n",
       "      <td>1.4</td>\n",
       "      <td>5.1</td>\n",
       "      <td>264</td>\n",
       "      <td>9</td>\n",
       "      <td>27.2</td>\n",
       "      <td>20,070</td>\n",
       "      <td>43.3</td>\n",
       "      <td>31,970</td>\n",
       "      <td>0.8</td>\n",
       "      <td>0.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Tunisia</td>\n",
       "      <td>11.0</td>\n",
       "      <td>163.6</td>\n",
       "      <td>71</td>\n",
       "      <td>67</td>\n",
       "      <td>46.5</td>\n",
       "      <td>4,230</td>\n",
       "      <td>121.2</td>\n",
       "      <td>11,020</td>\n",
       "      <td>2.7</td>\n",
       "      <td>1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Turkey</td>\n",
       "      <td>75.9</td>\n",
       "      <td>783.6</td>\n",
       "      <td>99</td>\n",
       "      <td>73</td>\n",
       "      <td>822.4</td>\n",
       "      <td>10,830</td>\n",
       "      <td>1,485.2</td>\n",
       "      <td>19,560</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Turkmenistan</td>\n",
       "      <td>5.3</td>\n",
       "      <td>488.1</td>\n",
       "      <td>11</td>\n",
       "      <td>50</td>\n",
       "      <td>42.5</td>\n",
       "      <td>8,020</td>\n",
       "      <td>77.1a</td>\n",
       "      <td>14,520a</td>\n",
       "      <td>10.3</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Turks and Caicos Islands</td>\n",
       "      <td>0.0k</td>\n",
       "      <td>1.0</td>\n",
       "      <td>36</td>\n",
       "      <td>92</td>\n",
       "      <td>..</td>\n",
       "      <td>..e</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Tuvalu</td>\n",
       "      <td>0.0k</td>\n",
       "      <td>0.0f</td>\n",
       "      <td>330</td>\n",
       "      <td>59</td>\n",
       "      <td>0.1</td>\n",
       "      <td>5,720</td>\n",
       "      <td>0.1a</td>\n",
       "      <td>5,410a</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Uganda</td>\n",
       "      <td>37.8</td>\n",
       "      <td>241.6</td>\n",
       "      <td>188</td>\n",
       "      <td>16</td>\n",
       "      <td>25.3</td>\n",
       "      <td>670</td>\n",
       "      <td>65.0</td>\n",
       "      <td>1,720</td>\n",
       "      <td>4.8</td>\n",
       "      <td>1.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>45.4</td>\n",
       "      <td>603.6</td>\n",
       "      <td>78</td>\n",
       "      <td>69</td>\n",
       "      <td>152.1</td>\n",
       "      <td>3,560</td>\n",
       "      <td>366.2</td>\n",
       "      <td>8,560</td>\n",
       "      <td>–6.8</td>\n",
       "      <td>–0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>United Arab Emirates</td>\n",
       "      <td>9.1</td>\n",
       "      <td>83.6</td>\n",
       "      <td>109</td>\n",
       "      <td>85</td>\n",
       "      <td>405.2</td>\n",
       "      <td>44,600</td>\n",
       "      <td>615.3</td>\n",
       "      <td>67,720</td>\n",
       "      <td>4.6</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>64.6</td>\n",
       "      <td>243.6</td>\n",
       "      <td>267</td>\n",
       "      <td>82</td>\n",
       "      <td>2,801.5</td>\n",
       "      <td>43,390</td>\n",
       "      <td>2,550.1</td>\n",
       "      <td>39,500</td>\n",
       "      <td>2.9</td>\n",
       "      <td>2.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>United States</td>\n",
       "      <td>318.9</td>\n",
       "      <td>9,831.5</td>\n",
       "      <td>35</td>\n",
       "      <td>81</td>\n",
       "      <td>17,611.5</td>\n",
       "      <td>55,230</td>\n",
       "      <td>17,823.2</td>\n",
       "      <td>55,900</td>\n",
       "      <td>2.4</td>\n",
       "      <td>1.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Uruguay</td>\n",
       "      <td>3.4</td>\n",
       "      <td>176.2</td>\n",
       "      <td>20</td>\n",
       "      <td>95</td>\n",
       "      <td>55.9</td>\n",
       "      <td>16,350</td>\n",
       "      <td>69.1</td>\n",
       "      <td>20,220</td>\n",
       "      <td>3.5</td>\n",
       "      <td>3.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Uzbekistan</td>\n",
       "      <td>30.8</td>\n",
       "      <td>447.4</td>\n",
       "      <td>72</td>\n",
       "      <td>36</td>\n",
       "      <td>64.3</td>\n",
       "      <td>2,090</td>\n",
       "      <td>179.4a</td>\n",
       "      <td>5,830a</td>\n",
       "      <td>8.1</td>\n",
       "      <td>6.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Vanuatu</td>\n",
       "      <td>0.3</td>\n",
       "      <td>12.2</td>\n",
       "      <td>21</td>\n",
       "      <td>26</td>\n",
       "      <td>0.8</td>\n",
       "      <td>3,160</td>\n",
       "      <td>0.8a</td>\n",
       "      <td>3,030a</td>\n",
       "      <td>2.3</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Venezuela, RB</td>\n",
       "      <td>30.7</td>\n",
       "      <td>912.1</td>\n",
       "      <td>35</td>\n",
       "      <td>89</td>\n",
       "      <td>373.3</td>\n",
       "      <td>12,500i</td>\n",
       "      <td>535.7</td>\n",
       "      <td>17,700</td>\n",
       "      <td>–4.0</td>\n",
       "      <td>–5.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Vietnam</td>\n",
       "      <td>90.7</td>\n",
       "      <td>331.0</td>\n",
       "      <td>293</td>\n",
       "      <td>33</td>\n",
       "      <td>171.9</td>\n",
       "      <td>1,890</td>\n",
       "      <td>485.2</td>\n",
       "      <td>5,350</td>\n",
       "      <td>6.0</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Virgin Islands (U.S.)</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.4</td>\n",
       "      <td>298</td>\n",
       "      <td>95</td>\n",
       "      <td>..</td>\n",
       "      <td>..e</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>West Bank and Gaza</td>\n",
       "      <td>4.3</td>\n",
       "      <td>6.0</td>\n",
       "      <td>713</td>\n",
       "      <td>75</td>\n",
       "      <td>13.1</td>\n",
       "      <td>3,060</td>\n",
       "      <td>21.5</td>\n",
       "      <td>5,000</td>\n",
       "      <td>–1.5</td>\n",
       "      <td>–4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Yemen, Rep.</td>\n",
       "      <td>26.2</td>\n",
       "      <td>528.0</td>\n",
       "      <td>50</td>\n",
       "      <td>34</td>\n",
       "      <td>33.3</td>\n",
       "      <td>1,300</td>\n",
       "      <td>93.3</td>\n",
       "      <td>3,650</td>\n",
       "      <td>4.2</td>\n",
       "      <td>1.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>15.7</td>\n",
       "      <td>752.6</td>\n",
       "      <td>21</td>\n",
       "      <td>40</td>\n",
       "      <td>26.4</td>\n",
       "      <td>1,680</td>\n",
       "      <td>57.9</td>\n",
       "      <td>3,690</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>15.2</td>\n",
       "      <td>390.8</td>\n",
       "      <td>39</td>\n",
       "      <td>33</td>\n",
       "      <td>12.8</td>\n",
       "      <td>840</td>\n",
       "      <td>25.2</td>\n",
       "      <td>1,650</td>\n",
       "      <td>3.8</td>\n",
       "      <td>1.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>World</td>\n",
       "      <td>7,259.7 s</td>\n",
       "      <td>134,325.3 s</td>\n",
       "      <td>56 w</td>\n",
       "      <td>53 w</td>\n",
       "      <td>78,399.9 t</td>\n",
       "      <td>10,799 w</td>\n",
       "      <td>108,477.1 t</td>\n",
       "      <td>14,942 w</td>\n",
       "      <td>2.5 w</td>\n",
       "      <td>1.3 w</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>East Asia &amp; Pacific</td>\n",
       "      <td>2,264.1</td>\n",
       "      <td>24,825.2</td>\n",
       "      <td>93</td>\n",
       "      <td>56</td>\n",
       "      <td>22,032.5</td>\n",
       "      <td>9,731</td>\n",
       "      <td>33,741.6</td>\n",
       "      <td>14,903</td>\n",
       "      <td>3.6</td>\n",
       "      <td>2.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Europe &amp; Central Asia</td>\n",
       "      <td>902.0</td>\n",
       "      <td>28,460.4</td>\n",
       "      <td>33</td>\n",
       "      <td>71</td>\n",
       "      <td>22,932.5</td>\n",
       "      <td>25,425</td>\n",
       "      <td>26,001.8</td>\n",
       "      <td>28,827</td>\n",
       "      <td>1.4</td>\n",
       "      <td>1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Latin America &amp; Caribbean</td>\n",
       "      <td>626.3</td>\n",
       "      <td>20,425.3</td>\n",
       "      <td>31</td>\n",
       "      <td>80</td>\n",
       "      <td>6,207.5</td>\n",
       "      <td>9,912</td>\n",
       "      <td>9,535.7</td>\n",
       "      <td>15,226</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Middle East &amp; North Africa</td>\n",
       "      <td>417.5</td>\n",
       "      <td>11,370.8</td>\n",
       "      <td>37</td>\n",
       "      <td>64</td>\n",
       "      <td>3,570.2</td>\n",
       "      <td>8,722</td>\n",
       "      <td>7,267.2</td>\n",
       "      <td>17,754</td>\n",
       "      <td>2.5</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>North America</td>\n",
       "      <td>354.5</td>\n",
       "      <td>19,816.2</td>\n",
       "      <td>19</td>\n",
       "      <td>81</td>\n",
       "      <td>19,452.6</td>\n",
       "      <td>54,879</td>\n",
       "      <td>19,406.4</td>\n",
       "      <td>54,748</td>\n",
       "      <td>2.4</td>\n",
       "      <td>1.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>South Asia</td>\n",
       "      <td>1,721.2</td>\n",
       "      <td>5,136.2</td>\n",
       "      <td>361</td>\n",
       "      <td>33</td>\n",
       "      <td>2,575.3</td>\n",
       "      <td>1,496</td>\n",
       "      <td>9,118.9</td>\n",
       "      <td>5,298</td>\n",
       "      <td>6.9</td>\n",
       "      <td>5.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Sub-Saharan Africa</td>\n",
       "      <td>974.3</td>\n",
       "      <td>24,291.1</td>\n",
       "      <td>41</td>\n",
       "      <td>37</td>\n",
       "      <td>1,603.7</td>\n",
       "      <td>1,646</td>\n",
       "      <td>3,309.3</td>\n",
       "      <td>3,396</td>\n",
       "      <td>4.4</td>\n",
       "      <td>1.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Low income</td>\n",
       "      <td>622.0</td>\n",
       "      <td>14,455.8</td>\n",
       "      <td>47</td>\n",
       "      <td>30</td>\n",
       "      <td>390.3</td>\n",
       "      <td>628</td>\n",
       "      <td>977.0</td>\n",
       "      <td>1,571</td>\n",
       "      <td>6.3</td>\n",
       "      <td>3.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Lower middle income</td>\n",
       "      <td>2,878.5</td>\n",
       "      <td>20,523.3</td>\n",
       "      <td>142</td>\n",
       "      <td>39</td>\n",
       "      <td>5,807.5</td>\n",
       "      <td>2,018</td>\n",
       "      <td>17,275.3</td>\n",
       "      <td>6,002</td>\n",
       "      <td>5.7</td>\n",
       "      <td>4.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Upper middle income</td>\n",
       "      <td>2,360.8</td>\n",
       "      <td>41,620.9</td>\n",
       "      <td>58</td>\n",
       "      <td>62</td>\n",
       "      <td>18,712.6</td>\n",
       "      <td>7,926</td>\n",
       "      <td>33,583.2</td>\n",
       "      <td>14,225</td>\n",
       "      <td>4.5</td>\n",
       "      <td>3.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>High income</td>\n",
       "      <td>1,398.4</td>\n",
       "      <td>57,725.3</td>\n",
       "      <td>25</td>\n",
       "      <td>81</td>\n",
       "      <td>53,561.2</td>\n",
       "      <td>38,301</td>\n",
       "      <td>56,961.0</td>\n",
       "      <td>40,732</td>\n",
       "      <td>1.7</td>\n",
       "      <td>1.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       Country Population Surface area Population density  \\\n",
       "0                     Tanzania       51.8        947.3                 59   \n",
       "1                     Thailand       67.7        513.1                133   \n",
       "2                  Timor-Leste        1.2         14.9                 82   \n",
       "3                         Togo        7.1         56.8                131   \n",
       "4                        Tonga        0.1          0.8                147   \n",
       "5          Trinidad and Tobago        1.4          5.1                264   \n",
       "6                      Tunisia       11.0        163.6                 71   \n",
       "7                       Turkey       75.9        783.6                 99   \n",
       "8                 Turkmenistan        5.3        488.1                 11   \n",
       "9     Turks and Caicos Islands       0.0k          1.0                 36   \n",
       "10                      Tuvalu       0.0k         0.0f                330   \n",
       "11                      Uganda       37.8        241.6                188   \n",
       "12                     Ukraine       45.4        603.6                 78   \n",
       "13        United Arab Emirates        9.1         83.6                109   \n",
       "14              United Kingdom       64.6        243.6                267   \n",
       "15               United States      318.9      9,831.5                 35   \n",
       "16                     Uruguay        3.4        176.2                 20   \n",
       "17                  Uzbekistan       30.8        447.4                 72   \n",
       "18                     Vanuatu        0.3         12.2                 21   \n",
       "19               Venezuela, RB       30.7        912.1                 35   \n",
       "20                     Vietnam       90.7        331.0                293   \n",
       "21       Virgin Islands (U.S.)        0.1          0.4                298   \n",
       "22          West Bank and Gaza        4.3          6.0                713   \n",
       "23                 Yemen, Rep.       26.2        528.0                 50   \n",
       "24                      Zambia       15.7        752.6                 21   \n",
       "25                    Zimbabwe       15.2        390.8                 39   \n",
       "26                       World  7,259.7 s  134,325.3 s               56 w   \n",
       "27         East Asia & Pacific    2,264.1     24,825.2                 93   \n",
       "28       Europe & Central Asia      902.0     28,460.4                 33   \n",
       "29   Latin America & Caribbean      626.3     20,425.3                 31   \n",
       "30  Middle East & North Africa      417.5     11,370.8                 37   \n",
       "31               North America      354.5     19,816.2                 19   \n",
       "32                  South Asia    1,721.2      5,136.2                361   \n",
       "33          Sub-Saharan Africa      974.3     24,291.1                 41   \n",
       "34                  Low income      622.0     14,455.8                 47   \n",
       "35         Lower middle income    2,878.5     20,523.3                142   \n",
       "36         Upper middle income    2,360.8     41,620.9                 58   \n",
       "37                 High income    1,398.4     57,725.3                 25   \n",
       "\n",
       "   Urban pop % GNI Atlas Method (Billions) GNI Atlas Method (Per capita)  \\\n",
       "0           31                       46.4t                          920t   \n",
       "1           49                       391.7                         5,780   \n",
       "2           32                         3.2                         2,680   \n",
       "3           39                         4.0                           570   \n",
       "4           24                         0.4                         4,260   \n",
       "5            9                        27.2                        20,070   \n",
       "6           67                        46.5                         4,230   \n",
       "7           73                       822.4                        10,830   \n",
       "8           50                        42.5                         8,020   \n",
       "9           92                          ..                           ..e   \n",
       "10          59                         0.1                         5,720   \n",
       "11          16                        25.3                           670   \n",
       "12          69                       152.1                         3,560   \n",
       "13          85                       405.2                        44,600   \n",
       "14          82                     2,801.5                        43,390   \n",
       "15          81                    17,611.5                        55,230   \n",
       "16          95                        55.9                        16,350   \n",
       "17          36                        64.3                         2,090   \n",
       "18          26                         0.8                         3,160   \n",
       "19          89                       373.3                       12,500i   \n",
       "20          33                       171.9                         1,890   \n",
       "21          95                          ..                           ..e   \n",
       "22          75                        13.1                         3,060   \n",
       "23          34                        33.3                         1,300   \n",
       "24          40                        26.4                         1,680   \n",
       "25          33                        12.8                           840   \n",
       "26        53 w                  78,399.9 t                      10,799 w   \n",
       "27          56                    22,032.5                         9,731   \n",
       "28          71                    22,932.5                        25,425   \n",
       "29          80                     6,207.5                         9,912   \n",
       "30          64                     3,570.2                         8,722   \n",
       "31          81                    19,452.6                        54,879   \n",
       "32          33                     2,575.3                         1,496   \n",
       "33          37                     1,603.7                         1,646   \n",
       "34          30                       390.3                           628   \n",
       "35          39                     5,807.5                         2,018   \n",
       "36          62                    18,712.6                         7,926   \n",
       "37          81                    53,561.2                        38,301   \n",
       "\n",
       "   Purchasing power (Billions) Purchasing power (Per capita) GDP % growth  \\\n",
       "0                       126.3t                        2,510t         7.0t   \n",
       "1                      1,006.9                        14,870          0.9   \n",
       "2                         6.2a                        5,080a          7.0   \n",
       "3                          9.2                         1,290          5.7   \n",
       "4                         0.6a                        5,270a          2.1   \n",
       "5                         43.3                        31,970          0.8   \n",
       "6                        121.2                        11,020          2.7   \n",
       "7                      1,485.2                        19,560          2.9   \n",
       "8                        77.1a                       14,520a         10.3   \n",
       "9                           ..                            ..           ..   \n",
       "10                        0.1a                        5,410a          2.0   \n",
       "11                        65.0                         1,720          4.8   \n",
       "12                       366.2                         8,560         –6.8   \n",
       "13                       615.3                        67,720          4.6   \n",
       "14                     2,550.1                        39,500          2.9   \n",
       "15                    17,823.2                        55,900          2.4   \n",
       "16                        69.1                        20,220          3.5   \n",
       "17                      179.4a                        5,830a          8.1   \n",
       "18                        0.8a                        3,030a          2.3   \n",
       "19                       535.7                        17,700         –4.0   \n",
       "20                       485.2                         5,350          6.0   \n",
       "21                          ..                            ..           ..   \n",
       "22                        21.5                         5,000         –1.5   \n",
       "23                        93.3                         3,650          4.2   \n",
       "24                        57.9                         3,690          6.0   \n",
       "25                        25.2                         1,650          3.8   \n",
       "26                 108,477.1 t                      14,942 w        2.5 w   \n",
       "27                    33,741.6                        14,903          3.6   \n",
       "28                    26,001.8                        28,827          1.4   \n",
       "29                     9,535.7                        15,226          1.3   \n",
       "30                     7,267.2                        17,754          2.5   \n",
       "31                    19,406.4                        54,748          2.4   \n",
       "32                     9,118.9                         5,298          6.9   \n",
       "33                     3,309.3                         3,396          4.4   \n",
       "34                       977.0                         1,571          6.3   \n",
       "35                    17,275.3                         6,002          5.7   \n",
       "36                    33,583.2                        14,225          4.5   \n",
       "37                    56,961.0                        40,732          1.7   \n",
       "\n",
       "   GDP per capita growth  \n",
       "0                   3.6t  \n",
       "1                    0.5  \n",
       "2                    4.2  \n",
       "3                    2.9  \n",
       "4                    1.7  \n",
       "5                    0.4  \n",
       "6                    1.7  \n",
       "7                    1.7  \n",
       "8                    8.9  \n",
       "9                     ..  \n",
       "10                   1.8  \n",
       "11                   1.5  \n",
       "12                  –0.8  \n",
       "13                   4.0  \n",
       "14                   2.3  \n",
       "15                   1.6  \n",
       "16                   3.1  \n",
       "17                   6.3  \n",
       "18                   0.0  \n",
       "19                  –5.3  \n",
       "20                   4.9  \n",
       "21                    ..  \n",
       "22                  –4.3  \n",
       "23                   1.5  \n",
       "24                   2.8  \n",
       "25                   1.5  \n",
       "26                 1.3 w  \n",
       "27                   2.9  \n",
       "28                   1.2  \n",
       "29                   0.2  \n",
       "30                   0.5  \n",
       "31                   1.6  \n",
       "32                   5.5  \n",
       "33                   1.6  \n",
       "34                   3.5  \n",
       "35                   4.1  \n",
       "36                   3.7  \n",
       "37                   1.3  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list_of_df[4]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Concetenate all the DataFrames in the list into a single DataFrame so that we can use it for further wrangling and analysis.\n",
    "\n",
    "* Check the shape of the DataFrame. It should show 226 entries in total with 11 columns."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.concat(list_of_df,axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(226, 11)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Population</th>\n",
       "      <th>Surface area</th>\n",
       "      <th>Population density</th>\n",
       "      <th>Urban pop %</th>\n",
       "      <th>GNI Atlas Method (Billions)</th>\n",
       "      <th>GNI Atlas Method (Per capita)</th>\n",
       "      <th>Purchasing power (Billions)</th>\n",
       "      <th>Purchasing power (Per capita)</th>\n",
       "      <th>GDP % growth</th>\n",
       "      <th>GDP per capita growth</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>31.6</td>\n",
       "      <td>652.9</td>\n",
       "      <td>48</td>\n",
       "      <td>26</td>\n",
       "      <td>21.4</td>\n",
       "      <td>680</td>\n",
       "      <td>63.2a</td>\n",
       "      <td>2,000a</td>\n",
       "      <td>1.3</td>\n",
       "      <td>–1.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>2.9</td>\n",
       "      <td>28.8</td>\n",
       "      <td>106</td>\n",
       "      <td>56</td>\n",
       "      <td>12.9</td>\n",
       "      <td>4,450</td>\n",
       "      <td>31.8</td>\n",
       "      <td>10,980</td>\n",
       "      <td>2.2</td>\n",
       "      <td>2.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>38.9</td>\n",
       "      <td>2,381.7</td>\n",
       "      <td>16</td>\n",
       "      <td>70</td>\n",
       "      <td>213.8</td>\n",
       "      <td>5,490</td>\n",
       "      <td>540.5</td>\n",
       "      <td>13,880</td>\n",
       "      <td>3.8</td>\n",
       "      <td>1.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.2</td>\n",
       "      <td>277</td>\n",
       "      <td>87</td>\n",
       "      <td>..</td>\n",
       "      <td>..b</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.5</td>\n",
       "      <td>155</td>\n",
       "      <td>86</td>\n",
       "      <td>3.3</td>\n",
       "      <td>43,270</td>\n",
       "      <td>..</td>\n",
       "      <td>..</td>\n",
       "      <td>–0.1</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          Country Population Surface area Population density Urban pop %  \\\n",
       "0     Afghanistan       31.6        652.9                 48          26   \n",
       "1         Albania        2.9         28.8                106          56   \n",
       "2         Algeria       38.9      2,381.7                 16          70   \n",
       "3  American Samoa        0.1          0.2                277          87   \n",
       "4         Andorra        0.1          0.5                155          86   \n",
       "\n",
       "  GNI Atlas Method (Billions) GNI Atlas Method (Per capita)  \\\n",
       "0                        21.4                           680   \n",
       "1                        12.9                         4,450   \n",
       "2                       213.8                         5,490   \n",
       "3                          ..                           ..b   \n",
       "4                         3.3                        43,270   \n",
       "\n",
       "  Purchasing power (Billions) Purchasing power (Per capita) GDP % growth  \\\n",
       "0                       63.2a                        2,000a          1.3   \n",
       "1                        31.8                        10,980          2.2   \n",
       "2                       540.5                        13,880          3.8   \n",
       "3                          ..                            ..           ..   \n",
       "4                          ..                            ..         –0.1   \n",
       "\n",
       "  GDP per capita growth  \n",
       "0                  –1.7  \n",
       "1                   2.3  \n",
       "2                   1.8  \n",
       "3                    ..  \n",
       "4                   4.4  "
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Is the Data set clean and ready to be analyzed? \n",
    "* **Are there missing entries? How to handle them?**\n",
    "* **Are there entries not specific to countries but regions? Do we need them here or can they be copied to another data set?**\n",
    "\n",
    "#### As with any real-world example, this data set also needs further wrangling and cleaning before it can be used in an analytics pipeline. Those will not be discussed here but you can try on your own how to extract beautiful plots and insights from this dataset by using your data wrangling skills!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
